<!DOCTYPE html>
<html>

<head>
    <meta charset="utf-8">
    <title>layui</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <link rel="stylesheet" href="/lib/layui/css/layui.css" media="all">
    <link rel="stylesheet" href="/css/public.css" media="all">
    <link rel="stylesheet" type="text/css" href="../../css/your_stylesheet.css">
    <style>
        .wd_110{
            width: 112px;
        }
        .required-star {
            color: red;
        }
    </style>
</head>


<body>
    <div class="layuimini-container">
        <div class="layuimini-main">
            <form class="layui-form" action="">
                <div style="margin-top:20px">
                    <div class="layui-form-item">
                        <label class="layui-form-label wd_110" lay-verify="required"><span class="required-star">*</span>键:</label>
                        <div class="layui-input-inline layui-input-wrap">
                            <input  name="name" autocomplete="off" lay-affix="clear" class="layui-input">
                        </div>
                    </div>

                    <div class="layui-form-item">
                        <label class="layui-form-label wd_110" lay-verify="required"><span class="required-star">*</span>值:</label>
                        <div class="layui-input-inline layui-input-wrap">
                            <input id="dictValue"  name="value" autocomplete="off" lay-affix="clear" class="layui-input">
                        </div>
                    </div>


                    <div class="layui-form-item">
                        <label class="layui-form-label wd_110" lay-verify="required">备注:</label>
                        <div class="layui-input-inline layui-input-wrap">
                            <input  name="remark" autocomplete="off" lay-affix="clear" class="layui-input">
                        </div>
                    </div>

                </div>
            </form>
        </div>
    </div>
    </div>

    <script src="/lib/layui/layui.js" charset="utf-8"></script>
    <script src="/lib/axios/axios.js" charset="utf-8"></script>
    <script src="/js/lay-config.js?v=2.0.4" charset="utf-8"></script>


    <script>
        var $ = layui.jquery
        var form = layui.form;

        function formData() {
            let data = {
                name: $('[name= "name"]').val(),
                value: $('[name= "value"]').val(),
                remark: $('[name= "remark"]').val(),
            };
            if(!data.name || !data.value){
                layer.msg('必填项不能为空', {icon: 5});
                return null;
            }
            //返回数据给父页面
            return data;
        }

        layui.use('form', function () {
			var form = layui.form;
            let parentData = parent.data;
            console.log("parentData:"+JSON.stringify(parentData));
            if(parentData){
                (function(){
                    console.log(parentData)
                    $('[name= "name"]').val(parentData.name)
                    $('[name= "value"]').val(parentData.value)
                    $('[name= "remark"]').val(parentData.remark)
                })()
                form.render();
            }
        });
    </script>
</body>

</html>